package com.clotingshoppos.modules.Shiro.repository;

import com.clotingshoppos.common.base.BaseRepository.BaseRepository;
import com.clotingshoppos.modules.Shiro.entity.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface UserRepository extends BaseRepository<User> {
    @Query(value = "select password from user where username = :username", nativeQuery = true)
    String getPassword(@Param("username") String username);

    @Query(value = "select role from user where username = :username", nativeQuery = true)
    String getRole(@Param("username") String username);


    @Query(value = "select role.permission from user, role where username = :username and role.rolename = user.role", nativeQuery = true)
    String getRolePermission(@Param("username") String username);

    @Query(value = "select permission from  user where username = :username", nativeQuery = true)
    String getPermission(@Param("username") String username);
}